import React from "react";
import { Redirect } from "react-router";

const YYDiscover = React.lazy(() => import("@/pages/discover"));
const YYMy = React.lazy(() => import("@/pages/my"));
const YYFriend = React.lazy(() => import("@/pages/friend"));
const YYRecommend = React.lazy(() => import("../pages/discover/c-pages/recommend"));
const YYSongs = React.lazy(() => import("../pages/discover/c-pages/songs"));
const YYRanking = React.lazy(() => import("../pages/discover/c-pages/ranking"));
const YYDjRadio = React.lazy(() => import("../pages/discover/c-pages/djRadio"));
const YYArtist = React.lazy(() => import("../pages/discover/c-pages/artist"));
const YYAlbum = React.lazy(() => import("../pages/discover/c-pages/album"));

const routes = [
  {
    path: "/",
    exact: true,
    render: () => <Redirect to="/discover" />,
  },
  {
    path: "/discover",
    component: YYDiscover,
    routes: [
      {
        path: "/discover",
        exact: true,
        render: () => <Redirect to="/discover/recommend" />,
      },
      {
        path: "/discover/recommend",
        component: YYRecommend,
      },
      {
        path: "/discover/songs",
        component: YYSongs,
      },
      {
        path: "/discover/ranking",
        component: YYRanking,
      },
      {
        path: "/discover/djRadio",
        component: YYDjRadio,
      },
      {
        path: "/discover/artist",
        component: YYArtist,
      },
      {
        path: "/discover/album",
        component: YYAlbum,
      },
    ],
  },
  {
    path: "/my",
    component: YYMy,
  },
  {
    path: "/friend",
    component: YYFriend,
  },
];

export default routes;
